#!/usr/bin/perl
#show_interface.cgi

require './network-lib.pl';
&ReadParse();
if(!defined($in{'eth'}))
{
	error($text{'no_interface'});	
}
my $b = &get_active_interface($in{'eth'});
if($b eq "")
{
	error($text{'interface_not_exist'});
}
&header($text{'show_interface_title'}, "", undef, 0, 1);

#&calc_broadcast($b->{'address'},$b->{'netmask'});
print "<table class=group border=1 cellpadding=4 cellspacing=0 width=100%>\n";
printf "<tr class=title1> <td class=group> <b>$text{'adapter_name'}%s</b></td></tr>\n",&get_showname($in{'eth'});
print "<tr> <td class=group><table class=mode1 cellpadding=3 cellspacing=0",
	"width=100%>\n";

print "<tr> <td width=250> <b> $text{'ifcs_name'} </b> </td> \n";
print "<td>", &get_adaptername($b->{'irq'}), "</td> </tr>\n";

print "<tr> <td width=250> <b> $text{'ifcs_mac'} </b> </td> \n";
print "<td>$b->{'ether'}</td> </tr>\n";

print "<tr> <td width=250> <b> $text{'ifcs_ip'} </b> </td> \n";
print "<td>$b->{'address'}</td> </tr>\n";

print "<tr> <td width=250> <b> $text{'ifcs_mask'} </b> </td> \n";
print "<td>$b->{'netmask'}</td> </tr>\n";

print "<tr> <td width=250> <b> $text{'ifcs_broadcast'} </b> </td> \n";
print "<td>$b->{'broadcast'}</td> </tr>\n";

#print "<tr> <td width=250> <b> $text{'ifcs_gateway'} </b> </td> \n";
#print "<td>$b->{'gateway'}</td> </tr>\n";

print "<tr> <td width=250> <b> $text{'ifcs_rx'} </b> </td> \n";
print "<td>$b->{'rx'}</td> </tr>\n";

print "<tr> <td width=250> <b> $text{'ifcs_tx'} </b> </td> \n";
print "<td>$b->{'tx'}</td> </tr>\n";

print "</table>\n";
print "</table>\n";


&footer("index.cgi", $text{'interface_return'});
=xxx
if($b->{'virtual'} eq "")
{
&header($text{'show_interface_title'}, "", "editinterface", 0, 1);
#print "<hr>\n";
print "<form action=save_interface.cgi method=post onsubmit='document.forms[0].savebtn.disabled = true;'>\n";
print "<input type=hidden name=eth value='$in{'eth'}'>\n";
print "<table class=mode1 border=0 cellspacing=0 cellpadding=4>\n";
print "<tr><td><b>$text{'ifcs_name'}</b></td>\n";
print "<td>", &get_adaptername($b->{'irq'}), "</td> </tr>\n";
print "<tr><td><b>$text{'ifcs_mac'}</b></td>\n";
print "<td>$b->{'ether'}</td> </tr>\n";
print "<tr><td><b>$text{'ifcs_ip'}</b></td>\n";
printf "<td><input type=radio name=iprdn %s value='dhcp'>$text{'from_dhcp'}</td> </tr>\n", ($b->{'dhcp'})?"checked":"";
printf "<tr><td></td><td><input type=radio name=iprdn %s value='bootp'>$text{'from_bootp'}</td> </tr>\n", ($b->{'bootp'})?"checked":"";
printf "<tr><td></td><td><input type=radio name=iprdn %s value='static'><input class=text name=ipin value='$b->{'address'}'></td> </tr>\n", ((!$b->{'dhcp'})&&!($b->{'bootp'}))?"checked":"";
print "<tr><td><b>$text{'ifcs_mask'}</b></td>\n";
print "<td><input class=text name=maskin size=25 value='$b->{'netmask'}'></td> </tr>\n";
print "<tr><td><b>$text{'ifcs_broadcast'}</b></td>\n";
print "<td><input class=text name=broadcastin size=25 value='$b->{'broadcast'}'></td> </tr>\n";
print "<tr><td><b>$text{'ifcs_gateway'}</b></td>\n";
print "<td><input class=text name=gatewayin size=25 value='$b->{'gateway'}'></td> </tr>\n";
print "<tr><td colspan=2><input class=button1 type=submit name=savebtn value='$text{'submit'}'></td></tr>\n";
print "</table></form>\n";
#print "<hr>\n";
&footer("index.cgi", $text{'interface_return'});
}
elsif($b->{'virtual'} eq "MASTER")
{
&header($text{'edit_interface_title'}, "", "editinterface", 0, 1);
print "<form action=save_interface.cgi method=post onsubmit='document.forms[0].savebtn.disabled = true;'>\n";
print "<input type=hidden name=eth value='$in{'eth'}'>\n";
print "<table class=mode1 border=0 cellspacing=0 cellpadding=4>\n";
print "<tr><td><b>$text{'ifcs_name'}</b></td>\n";
print "<td>", &get_adaptername($b->{'irq'}), "</td> </tr>\n";
print "<tr><td><b>$text{'ifcs_mac'}</b></td>\n";
print "<td>$b->{'ether'}</td> </tr>\n";
print "<tr><td><b>$text{'ifcs_ip'}</b></td>\n";
printf "<td><input type=radio name=iprdn %s value='dhcp'>$text{'from_dhcp'}</td> </tr>\n", ($b->{'dhcp'})?"checked":"";
printf "<tr><td></td><td><input type=radio name=iprdn %s value='bootp'>$text{'from_bootp'}</td> </tr>\n", ($b->{'bootp'})?"checked":"";
printf "<tr><td></td><td><input type=radio name=iprdn %s value='static'><input class=text name=ipin value='$b->{'address'}'></td> </tr>\n", ((!$b->{'dhcp'})&&!($b->{'bootp'}))?"checked":"";
print "<tr><td><b>$text{'ifcs_mask'}</b></td>\n";
print "<td><input class=text name=maskin size=25 value='$b->{'netmask'}'></td> </tr>\n";
print "<tr><td><b>$text{'ifcs_broadcast'}</b></td>\n";
print "<td><input class=text name=broadcastin size=25 value='$b->{'broadcast'}'></td> </tr>\n";
print "<tr><td><b>$text{'ifcs_gateway'}</b></td>\n";
print "<td><input class=text name=gatewayin size=25 value='$b->{'gateway'}'></td> </tr>\n";
print "<tr><td colspan=2><input class=button1 type=submit name=savebtn value='$text{'submit'}'></td></tr>\n";
print "</table></form>\n";
&footer("index.cgi", $text{'interface_return'});
}
elsif($b->{'virtual'} eq "SLAVE")
{
&header($text{'edit_interface_title'}, "", "editinterface", 0, 1);
#print "<hr>\n";
print "<form action=save_interface.cgi method=post onsubmit='document.forms[0].savebtn.disabled = true;'>\n";
print "<input type=hidden name=eth value='$in{'eth'}'>\n";
print "<table class=mode1 border=0 cellspacing=0 cellpadding=4>\n";
print "<tr><td><b>$text{'ifcs_name'}</b></td>\n";
print "<td>", &get_adaptername($b->{'irq'}), "</td> </tr>\n";
print "<tr><td><b>$text{'ifcs_mac'}</b></td>\n";
print "<td>$b->{'ether'}</td> </tr>\n";
print "<tr><td><b>$text{'ifcs_ip'}</b></td>\n";
printf "<td><input type=radio name=iprdn %s value='dhcp'>$text{'from_dhcp'}</td> </tr>\n", ($b->{'dhcp'})?"checked":"";
printf "<tr><td></td><td><input type=radio name=iprdn %s value='bootp'>$text{'from_bootp'}</td> </tr>\n", ($b->{'bootp'})?"checked":"";
printf "<tr><td></td><td><input type=radio name=iprdn %s value='static'><input class=text name=ipin value='$b->{'address'}'></td> </tr>\n", ((!$b->{'dhcp'})&&!($b->{'bootp'}))?"checked":"";
print "<tr><td><b>$text{'ifcs_mask'}</b></td>\n";
print "<td><input class=text name=maskin size=25 value='$b->{'netmask'}'></td> </tr>\n";
print "<tr><td><b>$text{'ifcs_broadcast'}</b></td>\n";
print "<td><input class=text name=broadcastin size=25 value='$b->{'broadcast'}'></td> </tr>\n";
print "<tr><td><b>$text{'ifcs_gateway'}</b></td>\n";
print "<td><input class=text name=gatewayin size=25 value='$b->{'gateway'}'></td> </tr>\n";
#print "<tr><td colspan=2><input class=button1 type=submit name=savebtn value='$text{'submit'}'></td></tr>\n";
print "</table></form>\n";
#print "<hr>\n";
&footer("index.cgi", $text{'interface_return'});
}

=cut
